package com.shop.entity;

import java.util.List;
import java.util.Objects;

//订单表
public class Order {
    private int o_id;              //订单id
    private int u_id;             //用户id(外键)
    private double o_total;             //订单总金额
    private int o_pay;             //订单是否支付（0表示未支付，1表示已支付，默认值为0)
    private int o_status;             //（0表示未提交，1表示已提交，默认值为0）
    private String o_starttime;        //订单创建时间
    private List<UserOrderList> bank1;
    private String bank2;

    public Order() {
    }

    public Order(int o_id, int u_id, double o_total, int o_pay, int o_status, String o_starttime) {
        this.o_id = o_id;
        this.u_id = u_id;
        this.o_total = o_total;
        this.o_pay = o_pay;
        this.o_status = o_status;
        this.o_starttime = o_starttime;
    }

    public Order(int o_id, double o_total, int o_pay, int o_status, String o_starttime) {
        this.o_id = o_id;
        this.o_total = o_total;
        this.o_pay = o_pay;
        this.o_status = o_status;
        this.o_starttime = o_starttime;
    }

    public Order(int o_id, int u_id, double o_total, int o_pay, int o_status, String o_starttime, List<UserOrderList> bank1, String bank2) {
        this.o_id = o_id;
        this.u_id = u_id;
        this.o_total = o_total;
        this.o_pay = o_pay;
        this.o_status = o_status;
        this.o_starttime = o_starttime;
        this.bank1 = bank1;
        this.bank2 = bank2;
    }

    public List<UserOrderList> getBank1() {
        return bank1;
    }

    public void setBank1(List<UserOrderList> bank1) {
        this.bank1 = bank1;
    }

    public String getBank2() {
        return bank2;
    }

    public void setBank2(String bank2) {
        this.bank2 = bank2;
    }

    public int getO_id() {
        return o_id;
    }

    public void setO_id(int o_id) {
        this.o_id = o_id;
    }

    public int getU_id() {
        return u_id;
    }

    public void setU_id(int u_id) {
        this.u_id = u_id;
    }

    public double getO_total() {
        return o_total;
    }

    public void setO_total(double o_total) {
        this.o_total = o_total;
    }

    public int getO_pay() {
        return o_pay;
    }

    public void setO_pay(int o_pay) {
        this.o_pay = o_pay;
    }

    public int getO_status() {
        return o_status;
    }

    public void setO_status(int o_status) {
        this.o_status = o_status;
    }

    public String getO_starttime() {
        return o_starttime;
    }

    public void setO_starttime(String o_starttime) {
        this.o_starttime = o_starttime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Order order = (Order) o;
        return o_id == order.o_id &&
                u_id == order.u_id &&
                Double.compare(order.o_total, o_total) == 0 &&
                o_pay == order.o_pay &&
                o_status == order.o_status &&
                Objects.equals(o_starttime, order.o_starttime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(o_id, u_id, o_total, o_pay, o_status, o_starttime);
    }

    @Override
    public String toString() {
        return "Order{" +
                "o_id=" + o_id +
                ", u_id=" + u_id +
                ", o_total=" + o_total +
                ", o_pay=" + o_pay +
                ", o_status=" + o_status +
                ", o_starttime='" + o_starttime + '\'' +
                ", bank1=" + bank1 +
                ", bank2='" + bank2 + '\'' +
                '}';
    }
}
